function  displayResults(myJSONtext){

$( "#accordion" ).accordion( "destroy" );


var myObject = eval(myJSONtext);
document.getElementById("accordion").innerHTML="";
	for ( i=0;i <myObject.candidates.length;i++) {
         var candidate="";
		 var beginDiv ='<div><table>';
	        if (myObject.candidates[i].hasOwnProperty('candidateName')){	
			 candidate='<h3><a href="#">'+myObject.candidates[i].candidateName+'</a></h3>';
			}
			else
			{
			 candidate='<h3><a href="#">'+i+'</a></h3>';
			}
			var constituency="";
            if(myObject.candidates[i].hasOwnProperty('constituency')){
			  constituency='<tr><td>Constituency:</td><td>'+myObject.candidates[i].constituency+'</td></tr>';
			}
			var party="";
			if(myObject.candidates[i].hasOwnProperty('party')){
			   party='<tr><td>Party:</td><td>'+myObject.candidates[i].party+'</td></tr>';
			}
			var description="";
			if(myObject.candidates[i].hasOwnProperty('general_description')){
			 description= '<tr><td>Description :</td><td>'+myObject.candidates[i].general_description+'</td></tr>';
			}
			var policies="";
			if(myObject.candidates[i].hasOwnProperty('policies')){
			   policies= '<tr><td>Policies :</td><td>'+myObject.candidates[i].policies+'</td></tr>';
			}
			var twitter="";
			if(myObject.candidates[i].hasOwnProperty('twitter')){
			   twitter='<tr><td colspan="2" class="twitter" style="display:inline; float:center" ><a href="'+myObject.candidates
			[i].twitter+'">@'+myObject.candidates[i].twitter+'</a></td></tr>';
			}
			var webpage="";
			if(myObject.candidates[i].hasOwnProperty('webpage')){
			  webpage='<tr><td colspan="2" class="webpage" style="display:inline; float:center" ><a href="'+myObject.candidates[i].webpage+'" target="_blank">'+myObject.candidates[i].webpage+'</a></td></tr>';
			}
			var email="";
			if(myObject.candidates[i].hasOwnProperty('mail')){
			   email='<tr><td colspan="2" class="email" style="display:inline; float:center" ><a href="mailto:'+myObject.candidates[i].mail+'">'+myObject.candidates[i].mail+'</a></td></tr>';
			}
			var phone="";
			if(myObject.candidates[i].hasOwnProperty('phone')){
			   phone='<tr><td colspan="2" class="phone" style="display:inline; float:center" ><span>'+myObject.candidates[i].phone+'</span></td></tr>';
			}
			var trivia="";
			if(myObject.candidates[i].hasOwnProperty('trivia')){
			  trivia='<tr><td>Trivia:</td><td>'+myObject.candidates[i].trivia+'</td></tr>';
			}
			var image="";
			if(myObject.candidates[i].hasOwnProperty('image')){
			  image='<tr><td colspan><img src="'+myObject.candidates[i].image+'"width= 197px; height=190px /></td></tr>';
			}
			var facebook="";
			if(myObject.candidates[i].hasOwnProperty('facebook')){
			    facebook='<tr><td colspan="2" class="facebook" style="display:inline; float:center" ><a href="'+myObject.candidates[i].facebook+'">'+myObject.candidates[i].facebook+'</a></td></tr>';
			}

			var endDiv ='</table></div>';

			
			
		 document.getElementById("accordion").innerHTML+=candidate+
														beginDiv+
														image+
														constituency+
														party+
														description+
														policies+
														facebook+
														twitter+
														webpage+
														email+
														phone+
														trivia+
														endDiv;
	   }
    
    


	$( "#accordion" ).accordion();
} 